package com.cs.study.homework._0207;

import java.util.Scanner;

public class Binary {
    public static void main(String[] args) {
        System.out.println("请输入一个数：");
        Scanner sc = new Scanner(System.in);
        int num = sc.nextInt();
        System.out.print(num + "的二进制为");
        getBinary(num);

    }
    public static void getBinary(int n) {
        if (n >= 2) {
            getBinary(n / 2);
        }
        System.out.print(n % 2);
    }
}
